<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests\UserRegister;
use App\Services\User as Service;

class UserController extends Controller
{
    protected Service $service;

    public function __construct()
    {
        $this->service = new Service();
    }

    public function register(UserRegister $request)
    {
        $data = $request->only([
            'acc_lg_name',
            'acc_lg_pwd',
            'acc_user_nick',
            'acc_user_icon',
            'user_age',
        ]);

        $acc = $this->service->register($data);

        return $this->success('success', ['acc' => $acc]);
    }
}
